/*
 * conceptualBO.java
 *
 * Created on March 5, 2007, 8:07 PM
 *
 */

package edu.byu.isys413.group1E.data;

import java.sql.SQLException;
import java.util.Calendar;
import java.util.Date;
import edu.byu.isys413.group1E.data.*;
import edu.byu.isys413.group1E.handlers.*;
/**
 * Represents a coneptual product or a conceptual rental
 * @author tkulbeth
 */
public class ConceptualBO extends ProductBO {
    
    private String productName;
    private String Description;
    private ManufacturerBO manufacturer;
    private WarrantyBO warranty;
    private String category;
    private double averageCost;
    private boolean forRent;
    private ConceptualRentalDAO crDAO;
    
    /** Creates a new instance of conceptualBO */
    ConceptualBO() {
    }
    
    /**
     * Creates a new instance of TransactionBO with an ID
     * @param productID ID
     */
    ConceptualBO(String productID) {
        setProductID(productID);
        this.setDirty(true);
    }
      
    /**gets the productName of the conceptual product
     *
     * @return productName of product
     */
    public String getProductName() {
        return productName;
    }
    
    /**
     * sets the product name of the conceptual product
     * @param productName null
     */
    public void setProductName(String productName) {
        this.productName = productName;
        setDirty(true);
    }
    
    /**gets the description of the conceptual product
     *
     * @return Description the description
     */
    public String getDescription() {
        return Description;
    }
    
    /**
     * sets the description of the conceptual product
     * @param Description contains the description
     */
    public void setDescription(String Description) {
        this.Description = Description;
        setDirty(true);
    }
    
    /**gets the average cost 
     *
     * @return averageCost the average cost of the conceptual product
     */
    public double getAverageCost() {
        return averageCost;
    }
    
    /**
     * sets the averageCost of the conceptual product
     * @param averageCost contains the average cost
     */
    public void setAverageCost(double averageCost) {
        this.averageCost = averageCost;
        setDirty(true);
    }
    
    /**gets the manufacturer object
     *
     * @return manufacturer
     */
    public ManufacturerBO getManufacturer() {
        return manufacturer;
    }
    
    /**sets the manufacturer of the product
     *
     * @param manufacturer contains manufacturer
     */
    public void setManufacturer(ManufacturerBO manufacturer) {
        this.manufacturer = manufacturer;
        setDirty(true);
    }
    
    /**gets the WarrantyBO of the item
     *
     * @return warranty contains warranty
     */
    public WarrantyBO getWarranty() {
        return warranty;
    }
    
    /**sets the Warranty of the item
     *
     * @param warranty warranty
     */
    public void setWarranty(WarrantyBO warranty) {
        this.warranty = warranty;
        setDirty(true);
    }
    
    /**
     * gets the category for the conceptual product
     * @return category
     */
    public String getCategory() {
        return category;
    }
    
    /**
     *sets the category for the Conceptual Product
     *
     *@param category contains category
     */
    public void setCategory(String category) {
        this.category = category;
        setDirty(true);
    }
    
    /**
     *return the rental status
     *
     *@return forRent rental status
     */
    public boolean isForRent() {
        return forRent;
    }
    
    /**
     *sets the rental status
     *
     *@param forRent rental status
     */
    public void setForRent(boolean forRent) {
        this.forRent = forRent;
        setDirty(true);
    }
    
    /**
     *returns the priceperDay of the rental of this conceptual product
     *
     *@return PricePerDay the Price per Day
     */
    public double getPPD() 
    {
        ConceptualRentalBO crBO = null;
        try {
            crBO = (ConceptualRentalBO) ConceptualRentalDAO.getInstance().read(this.getProductID());
        } catch (DataException ex) {
            ex.printStackTrace();
        } catch (ConnectionPoolException ex) {
            ex.printStackTrace();
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
        return crBO.getPricePerDay();
    }
}
